package cn.wx.jove.config;

import org.springframework.context.annotation.Configuration;  
/*import org.springframework.core.Ordered;*/
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
/*import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;*/
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

import cn.wx.jove.tool.interceptor.RequestInterceptor;

  
@Configuration  
public class WebConfiguration extends WebMvcConfigurationSupport {  

	@Override
	protected void addResourceHandlers(ResourceHandlerRegistry registry) {
	    registry.addResourceHandler("swagger-ui.html")
	            .addResourceLocations("classpath:/META-INF/resources/");
	    registry.addResourceHandler("/webjars/**")
        .addResourceLocations("classpath:/META-INF/resources/webjars/");
	}
	
/*    @Override  
    public void addViewControllers(ViewControllerRegistry registry) {  
    	registry.addViewController("/").setViewName("forward:/index");
        registry.setOrder(Ordered.HIGHEST_PRECEDENCE);  
        super.addViewControllers(registry);  
    }  */
    
    @Override
    public void addInterceptors(InterceptorRegistry registry){
    	registry.addInterceptor(new RequestInterceptor())
    	.addPathPatterns("/sholar/**")
    	.excludePathPatterns("/sholarLogin/**");//登录请求 不过滤
    }
    
    
}  